#include <stdlib.h>
#include <stdio.h>

/* change d size as needed */
int dimension = 128;

int main(int argc, char *argv[])
{
	int d = dimension, i, j, k;
	double *A, *B, *C;

	srand(292);
	A = (double*)malloc(d*d*sizeof(double));
	B = (double*)malloc(d*d*sizeof(double));
	C = (double*)malloc(d*d*sizeof(double));

	for(i = 0; i < d; i++) {
		for(j = 0; j < d; j++) {
			A[d*i+j] = (rand()/(RAND_MAX - 1.0));
			B[d*i+j] = (rand()/(RAND_MAX - 1.0));
			C[d*i+j] = 0.0;
		}
	}

	for(i = 0; i < d; i++) {
		for(j = 0; j < d; j++) {
			for(k = 0; k < d; k++) {
				C[d*i+j] += A[d*i+k] * B[d*k+j];
			}
		}
	}
	free(A);
	free(B);
	free(C);


	return 0;
}
